package com.acme.mock;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {

	private ServerSocket ss;
	
	public void start(int port) throws IOException {
		ServerSocket ss = new ServerSocket(port);
		while(true) {
			try{
				new Thread (new Handler(ss.accept())).start();
			}
			catch (IOException e) {
				throw new IOException();
			}
		}
	}
	
}

class Handler implements Runnable {
	InputStream is;
	OutputStream os;
	public Handler(Socket socket) throws IOException {		
		is = socket.getInputStream();
		os = socket.getOutputStream();
	}
	
	@Override
	public void run() {
		while (!Thread.interrupted()) {
			//block
			//work
			//write
		}		
	}
	
}
